Java SE 8 for the Really Impatient by Cay S. Horstmann

Java SE 8 for the Really Impatient by Cay S. Horstmann

Author:Cay S. Horstmann [Horstmann, Cay S.]
Language: eng
Format: mobi, pdf
Publisher: Pearson Education
Published: 2014-01-09T16:00:00+00:00


LocalDate backToWork = today.with(NEXT_WORKDAY);

Note that the parameter of the lambda expression has type Temporal, and it must be cast to LocalDate. You can avoid this cast with the ofDateAdjuster method that expects a lambda of type UnaryOperator<LocalDate>.

Click here to view code image

TemporalAdjuster NEXT_WORKDAY = TemporalAdjusters.ofDateAdjuster(w -> {

LocalDate result = w; // No cast

do {

result = result.plusDays(1);

} while (result.getDayOfWeek().getValue() >= 6);

return result;

});



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.